<template>
	<view class="">
		<!-- <u-navbar :is-back='false' :border-bottom='false' title='商家入口' title-color='#ffffff' :is-fixed='true'
			:background='background'>
			<view class="slot-wrap">
				<view @click="back"
					style="border-radius: 50%;width: 50rpx;height: 50rpx;background-color:rgba(0,0,0,.2);position: relative;">
					<text class="iconfont icon-xiangzuo"
						style="font-size: 40rpx;color: #FFFFFF;position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);"></text>
				</view>

			</view>
		</u-navbar> -->
		<view style="width: 750rpx;height: 366rpx;background: linear-gradient(180deg, #1fb0ac 0%, #F5F5F5 100%);position: relative;">
			<view class="" style="padding-top: 50rpx;padding-bottom: 30rpx;">
				<view style="width: 90%;margin: 0 auto;font-size: 50rpx;color: #FFFFFF;line-height: 80rpx;">
					企业入口
				</view>
				<view style="width: 90%;margin: 0 auto;font-size: 26rpx;color: #FFFFFF;opacity: 0.6;">
					以便更好的给您提供个性化服务
				</view>
				<view style="width: 100%;background-color: #FFFFFF;border-radius: 20rpx 20rpx 0 0;box-sizing: border-box;padding: 20rpx 30rpx;margin-top: 60rpx;">
					<view class="hang">
						<view class="shang">
							<image src="../../static/ws3.png" class="wan" mode=""></image>
							<view class="name">
								请选择搜索您要加入的企业
							</view>
						</view><!--  -->
						<view style="position: relative;">
							 <inputSearch :dataSource="dataSource" @select="handleChange" placeholder="请输入企业名称" />
							<!-- <input v-model="mingcheng" @blur="gong"  type="text" class="name_input"   placeholder="请输入企业名称" placeholder-class="zhi" /> -->
							<text class="iconfont icon-xiangyou" style="position: absolute;top: 50%;right: 46rpx;transform: translateY(-50%);color: #666;"></text>
						</view>


					</view>
				</view>
				<view @click="deng" style="background: linear-gradient( 139deg, #1CD19F 0%, #1FB0AC 100%);width: 92%;margin: 40rpx auto;height: 90rpx;line-height: 90rpx;color: #FFFFFF;text-align: center;border-radius: 45rpx;font-size: 30rpx;">
					申请加入
				</view>
				<view style="line-height: 90rpx;color: #000000;font-size: 24rpx;text-align: center;margin-top: 150rpx;">
					或者对您的企业进行认证
				</view>
				<view @click="ruzhu" style="background: linear-gradient( 139deg, #1CD19F 0%, #1FB0AC 100%);width: 92%;margin: 0rpx auto;height: 90rpx;line-height: 90rpx;color: #FFFFFF;text-align: center;border-radius: 45rpx;font-size: 30rpx;">
					前往认证
				</view>
				<!-- <view @click="ruzhu" style="width: 92%;margin: 0rpx auto;background-color: #DD524D;height: 90rpx;line-height: 90rpx;color: #FFFFFF;text-align: center;border-radius: 45rpx;font-size: 30rpx;">
					我要入驻
				</view>
				<view style="line-height: 90rpx;color: #999999;font-size: 24rpx;text-align: center;margin-top: 20rpx;">
					客服电话：{{work.mobile}}
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	import inputSearch from '@/components/p-inputSearch/inputSearch.vue'
	export default{
		components: {
			inputSearch
		},
		data(){
			return{
				background: {
					background: 'linear-gradient(180deg, #0078FF 0%, #1fb0ac 100%)'
				},
				zhanghao:'',
				mima:'',
				work:{},
				dataSource: [],
				id:''
			}
		},
		onPullDownRefresh() {
			this.yang()
		       setTimeout(function () {
		           uni.stopPullDownRefresh();
		       }, 1500);
		  },
		onLoad() {
			this.syqy()
			// this.wo()
			// this.yang()
		},
		methods:{
			syqy:function(){
				this.post('api/firm_data/select_page','',true).then(res=>{
					if(res.code==1){
						this.dataSource=res.data
					}
				})
			},
			handleChange(data) {
			    console.log(data,123456748989777)
				this.id=data.id
			},
			// 联系我们
			wo:function(){
				this.post('api/help/contact','',true).then(res=>{
					console.log(res)
					if(res.code==1){
						this.work=res.data
					}
				})
			},
			// 增加访问量
			yang:function(){
				this.post('api/homepage/pageviews',{path:'/pages/my/rukou'},true).then(res=>{
					console.log(res)
				})
			},
			back:function(){
				uni.navigateBack({
					delta:1
				})
			},
			async ruzhu(){
				let {code: code1,data:data1} = await this.post('api/client/info', '', false)
				if (code1 != 1) {
					this.$u.toast('请先登录!')
					return
				}
				if (+data1.company_check === 1) {
					this.$u.toast('已申请企业认证，正在审核中，请耐心等待!')
					return
				} else if (+data1.firm_user === 0) {
					this.$u.toast('已申请加入企业，正在审核中，请耐心等待!')
					return
				}
				uni.navigateTo({
					url:'/subpages/pages/qy_leibie'
				})
			},
			async deng(){
				let {code: code1,data:data1} = await this.post('api/client/info', '', false)
				if (code1 != 1) {
					this.$u.toast('请先登录!')
					return
				}
				if (+data1.company_check === 1) {
					this.$u.toast('已申请企业认证，正在审核中，请耐心等待!')
					return
				} else if (+data1.firm_user === 0) {
					this.$u.toast('已申请加入企业，正在审核中，请耐心等待!')
					return
				}
				let {code,msg } = await this.post('api/firm/joins_company',{firm_id:this.id},true)
				if(code==1){
					uni.showToast({
						title: msg,
						icon: "none",
						duration: 1000
					})
					setTimeout(function(){
						uni.switchTab({
							url:'/pages/index/wode'
						})
					},1500)
				}else{
					uni.showToast({
						title: msg,
						icon: "none",
						duration: 1000
					})
				}
			},
			wx_deng:function(){
				this.post('api/firm/login','',true).then(res=>{
					console.log(res)
					if(res.code==1){
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
						uni.setStorageSync('shop_xx',res.data)
						setTimeout(function(){
							uni.navigateTo({
								url:'../../subpages/pages/shopjia'
							})
						},1500)
					}else{
						uni.showToast({
							title: res.msg,
							icon: "none",
							duration: 1000
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #FFFFFF !important;
		font-family: Demibold;
		// padding-bottom: 30rpx;
	}

	.slot-wrap {
		display: flex;
		align-items: center;
		/* 如果您想让slot内容占满整个导航栏的宽度 */
		/* flex: 1; */
		/* 如果您想让slot内容与导航栏左右有空隙 */
		padding: 0 30rpx;
	}
	.hang{
		width: 100%;
		// margin: 0 auto 20rpx;
		// box-sizing: border-box;
	}
	.shang{
		position: relative;
		padding-left: 40rpx;
		line-height: 80rpx;
		height: 80rpx;
	}
	.wan{
		width: 30rpx;
		height: 30rpx;
		position: absolute;
		top: 50%;
		left: 0;
		transform: translateY(-50%);
	}
	.name{
		color:#000000 ;
		font-size: 28rpx;
		font-weight: 600;
	}
	.name_input{
		width:100%;
		box-sizing: border-box;
		padding: 0 100rpx 0 46rpx;
		font-size:30rpx;
		background: #F3F3F3;
		height: 90rpx;
		line-height: 90rpx;
		border-radius: 45rpx;
		color: #000000;
	}
</style>
